﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using PlugNT.Common;
using FJASPX.Framwork.Helper;
using FJASPX.Framwork.Config;

namespace PlugNT.Cms.Web
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string userName = this.username.Value.Trim();
            string userPassword = this.password.Value.Trim();
            if (Membership.ValidateUser(userName, userPassword))
            {
                FormsAuthentication.SetAuthCookie(userName, false);
                if (Roles.IsUserInRole(userName, ConfigBase.GetConfig("RoleMember")))
                {
                    Response.Redirect("/Member/Default.aspx");
                }
                if (Roles.IsUserInRole(userName, ConfigBase.GetConfig("RolePersonal")))
                {
                    Response.Redirect("/Personal/Default.aspx");
                }
            }
            else
            {
                JScript.Alert("用户名或密码错误！", this.Page);
            }
        }
    }
}